from langchain_openai import AzureChatOpenAI
from langchain_core.messages import HumanMessage, SystemMessage
from dotenv import load_dotenv

import os
load_dotenv()

os.environ["AZURE_OPENAI_ENDPOINT"] = "https://chatgpt-test-0001.openai.azure.com/"
os.environ["AZURE_OPENAI_API_KEY"] = "90643b9c4bee421bba17d72b748ad446"

llmchat = AzureChatOpenAI(
    azure_deployment="testMini",  # or your deployment
    api_version="2024-06-01",  # or your api version
    temperature=0,
    max_tokens=None,
    timeout=None,
    max_retries=2,
    # other params...
)

# 创建提示模板
from langchain_core.prompts import ChatPromptTemplate
prompt = ChatPromptTemplate.from_messages([
        ("system","您是世界级的技术文档编写者。"),
        ("user""{input}")
    ])
#组合成一个简单的LLM链Linux psaux|gerp 3306
chain = prompt | llmchat
#使用LLM链
print(chain.invoke({"input":"大模型中的langchain是什么?"}).content)